/*
 * @file     g_uart.h
 * @brief    source file for setting uart
 *
 * Change Logs:
 * Date            Author             Version        Notes
 * 2021-08-06      wushengyan         V1.0.0         the first version
 */

#ifndef __G_OTP_H__
#define __G_OTP_H__
#include "g_1903.h"
#include "g_timer.h"

#define OTP_CSNADDR             (0x02)
#define OTP_CSNLEN              (12)
#define OTP_RC192ADDR           (0x12c)
#define OTP_RC192LEN            (2)
#define OTP_RC32KADDR           (0x136)
#define OTP_RC32KLEN            (3)
#define OTP_DVDDVTRIMADDR       (0x139)
#define OTP_DVDDVTRIMLEN        (1)
#define OTP_CHGRVCCADDR         (0x13c)
#define OTP_CHGRVCCLEN          (1)
#define OTP_CHGPUMPADDR         (0x146)
#define OTP_CHGPUMPLEN          (2)
#define OTP_HVLDOADDR           (0x148)
#define OTP_HVLDOLEN            (1)
#define OTP_ADCCLAIBADDR        (0x149)
#define OTP_ADCCLAIBLEN         (16)
#define OTP_VCARDVTRIMADDR      (0x159)
#define OTP_VCARDVTRIMLEN       (2)
#define OTP_DVDDVTRIMLPMADDR    (0x15e) 
#define OTP_DVDDVTRIMLPMLEN     (1)
#define OTP_DVDDLPMVDTVTHSEL    (0x15f)
#define OTP_DVDDLPMVDTVTHLEN    (1)

void G_OTP_Init(void);
void G_OTP_Deinit(void);
uint8_t G_OTP_Read(uint32_t addr,uint8_t *data,uint32_t len);
uint8_t G_OTP_Write(uint32_t addr, uint8_t *data, uint32_t len);
void G_OTP_Read_ChipId(uint8_t *id);
uint32_t G_OTP_Read_ChipLife(void);
uint8_t G_OTP_DataXOR(uint32_t data,uint8_t bit);

#endif
